import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JPanel;
import javax.swing.ImageIcon;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.GregorianCalendar;
import java.util.Date;
import java.util.Calendar;

public class iniInterface extends JFrame implements ActionListener
{
  private ImageIcon image = new ImageIcon("Cartoon bus.jpg");
  private JLabel imageLabel = new JLabel();
  private JButton manager = new JButton("Manager login");
  private JButton driver = new JButton("Driver login");
  private JButton passenger = new JButton("Passenger login");
  private Container content1;
  
  private static iniInterface ini;
  // Construct a new window
  public iniInterface()
  {
    content1 = getContentPane();
    setTitle("IBMS System");
    content1.setLayout(new GridLayout(0, 1));
    setLayout(new BorderLayout());
    content1.add(new JLabel("     "), BorderLayout.WEST);
    content1.add(imageLabel, BorderLayout.CENTER);
    imageLabel.setIcon(image);
    JPanel content2 = new JPanel(new GridLayout(0, 1));
    content1.add(content2, BorderLayout.SOUTH);
    content2.add(new JLabel("Please choose the user type:               "));
    // create a new button and add it to the contents
    content2.add(manager);
    // add a ActionListener for this button
    manager.addActionListener(this);
    // add in the contents a textlabel 
    content2.add(driver);
    driver.addActionListener(this);
    content2.add(passenger);
    passenger.addActionListener(this);
    // display the result in the restultextfield
    //  contents.add(resultJTextField);
    // exit the program in case the window it's closed
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    pack();
  }
  
  private managerInterface first;
  private DLoginInterface second;
  //private Interface third;
  public void actionPerformed(ActionEvent event)
  {
    if (event.getSource() == manager)
    {
      dispose();
      first = new managerInterface();
      first.setVisible(true);
    }
    else if (event.getSource() == driver)
    {
      dispose();
      second = new DLoginInterface();
      second.setVisible(true);
    } // actionPerformed
    else if (event.getSource() == passenger)
    {
      //third = new theInterface();
      //third.setVisible(true);
    } // actionPerformed
  }
  
  // create a new interface and display it
  public static void main(String[] args)
  {
    database.openBusDatabase();
    ini = new iniInterface();
    ini.setVisible(true);
  } // main*/
} // class
